package se.webbzon.oschi01.nbt;

import se.webbzon.oschi01.nbt.TagEvent.Action;

public class StringTag extends AbstractTag<String> {
	
	private short size;
	private String str;
	
	public StringTag(TagFactory<String> factory, String tagName, short size, String str) {
		super(factory, tagName);
		this.size = size;
		this.str = str;
	}

	@Override public long size() {
		return size;
	}

	@Override public String getValue() {
		return str;
	}

	@Override public void setValue(String value) {
		this.str = value;
		broadcastEvent(new TagEvent(this,Action.CHANGED,value));
	}

	@Override public Class<String> getValueClass() {
		return String.class;
	}

	@Override public AbstractTag<String> clone() {
		return new StringTag(getFactory(),this.toString(),size,str);
	}

}
